home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / xmasspak / ascend / ascend.asm < prev    next >
Encoding:
Assembly Source File  |  1996-01-21  |  4.1 KB  |  166 lines

  1. ; ASCENDANCY - Savegame Updater V1.0
  2. ;
  3. ; This little programm set up the science of your race to it's maximum!
  4. ;
  5. ; done by Capella/ESC for Genetic Dreams magazine November'95
  6. ;
  7.  
  8. ideal
  9. model large
  10. p386n
  11. stack 256
  12.  
  13. assume cs:coding
  14.  
  15. segment  coding
  16.  
  17. start:          mov ax,data_
  18.                 mov ds,ax
  19.                 assume ds:data_
  20.                 mov ax,0003h
  21.                 int 10h
  22.  
  23.                 mov ah,09h
  24.                 mov dx,offset begin_mess
  25.                 int 21h
  26.                 
  27.                 xor ax,ax
  28.                 int 16h
  29.                 cmp al,"1"
  30.                 je f1
  31.                 cmp al,"2"
  32.                 je f2
  33.                 cmp al,"3"
  34.                 je f3
  35.                 cmp al,"4"
  36.                 je f4
  37.                 cmp al,"5"
  38.                 je f5
  39.                 
  40.                 mov dx,offset no_file
  41.                 
  42.                 ;-------------------------------------
  43.  
  44. theend:         mov ah,09h
  45.                 int 21h
  46.                 mov ax,4c00h
  47.                 int 21h
  48.  
  49.                 ;-------------------------------------
  50.  
  51. f1:             mov dx,offset file1
  52.                 jmp read_file
  53. f2:             mov dx,offset file2
  54.                 jmp read_file
  55. f3:             mov dx,offset file3 
  56.                 jmp read_file
  57. f4:             mov dx,offset file4
  58.                 jmp read_file
  59. f5:             mov dx,offset file5
  60.                 
  61.  
  62. read_file:      mov [ds:errcode],4
  63.                 
  64.                 mov ax,3d02h
  65.                 int 21h
  66.                 jc error
  67.                 mov [ds:handle],ax
  68.                 mov bx,ax
  69.  
  70.                 mov cx,66
  71.                 
  72. x3x:            push cx
  73.                 
  74.                 mov [ds:errcode],5
  75.                 
  76.                 mov ax,4200h
  77.                 mov cx,[ds:file_high]
  78.                 mov dx,[ds:file_low]
  79.                 int 21h
  80.                 jc error
  81.  
  82.                 mov [ds:errcode],6
  83.                 
  84.                 mov ax,4000h
  85.                 mov bx,[ds:handle]
  86.                 mov dx,offset patch_codes
  87.                 mov cx,2
  88.                 int 21h
  89.                 jc error
  90.  
  91.                 pop cx
  92.  
  93.                 mov ax,[ds:file_low]
  94.                 clc
  95.                 add ax,75
  96.                 jc x1x
  97.                 mov [ds:file_low],ax
  98.  
  99.                 jmp x2x
  100.  
  101. x1x:            mov [ds:file_low],ax
  102.                 inc [word ds:file_high]
  103.  
  104. x2x:            dec cx
  105.                 jnz x3x
  106.  
  107.                 mov [ds:errcode],7
  108.                 
  109.                 mov ax,3e00h
  110.                 int 21h
  111.                 jc error
  112.  
  113.                 mov dx,offset ok_mess
  114.                 jmp theend
  115.  
  116. error:          mov [ds:errcode2],ax
  117.                 mov si,ax
  118.                 shl si,1
  119.                 mov dx,[ds:erroroff+si]
  120.                 jmp theend
  121.  
  122. ends  coding
  123.  
  124. segment  data_
  125.  
  126. file1           db "01.sav",0
  127. file2           db "02.sav",0
  128. file3           db "03.sav",0
  129. file4           db "04.sav",0
  130. file5           db "05.sav",0
  131.  
  132. handle          dw 0
  133.  
  134. file_high       dw 0       
  135. file_low        dw 254
  136.  
  137. patch_codes     db 7fh,7eh
  138.  
  139.                 db "ESC"
  140. errcode         db 0
  141. errcode2        dw 0
  142. begin_mess      db 13,10,"ASCENDANCY - Savegame Updater by Capella/Escape for "
  143.                 db 13,10,"Genetic Dreams Magazine (nov'95)",13,10
  144.                 db 10,"Press keys 1-5 for savegame to update....",13,10,"$"
  145. no_file         db 13,10,"No Savefile choosen",13,10,"$"
  146. ok_mess         db 13,10,"Jeppa, File is updated !!! Full technology available",13,10,10,"$"
  147.  
  148.                 
  149.  
  150. erroroff        dw offset err0,offset err1,offset err2,offset err3
  151.                 dw offset err0,offset err5,offset err6
  152.  
  153. err0            db 13,10,"err0 - not used error",13,10,"$"
  154. err1            db 13,10,"err1 - not allowed offset-code",13,10,"$"
  155. err2            db 13,10,"err2 - file not found",13,10,"$"
  156. err3            db 13,10,"err3 - path not found",13,10,"$"
  157. err5            db 13,10,"err5 - no access",13,10,"$"
  158. err6            db 13,10,"err6 - not allowed handle or file not open",13,10,"$"
  159.  
  160.  
  161. ends  data_
  162.  
  163. end start
  164.  
  165.  
  166.